import {createRouter, createWebHashHistory} from 'vue-router'

/** 默认布局 */
const Layout = () => import('@/layout/index.vue')

/** 静态路由 */
export const constantRoutes = [
    {
        path: '/',
        component: Layout,
        redirect: '/home',
        meta: {hidden: false},
        children: [
            {
                path: '/home',
                component: () => import('@/views/home/index.vue'),
                name: 'Home',
                meta: {title: '首页', hidden: false}
            },
            {
                path: '/ncpk',
                component: () => import('@/views/ncpk/index.vue'),
                name: 'Ncpk',
                meta: {title: '农产品库', hidden: false}
            },
            {
                path: '/shjz',
                component: () => import('@/views/shjz/index.vue'),
                name: 'Shjz',
                meta: {title: '社会捐赠', hidden: false}
            },
            {
                path: '/zcjd',
                component: () => import('@/views/zcjd/index.vue'),
                name: 'Zcjd',
                meta: {title: '政策解读', hidden: false}
            },
            {
                path: '/zcjdDetails',
                component: () => import('@/views/zcjd/details.vue'),
                name: 'ZcjdDetails',
                meta: {title: '政策解读详情', hidden: false}
            },
            {
                path: '/shjzDetails',
                component: () => import('@/views/shjz/details.vue'),
                name: 'ShjzDetails',
                meta: {title: '社会捐赠详细', hidden: false}
            },
            {
                path: '/user',
                component: () => import('@/views/user/index.vue'),
                name: 'User',
                meta: {title: '会员中心', hidden: false}
            },
        ]
    },
    {
        path: '/login',
        component: () => import('@/views/login/index.vue'),
        name: 'Login',
        meta: {title: '登录', hidden: false}
    },
]

const router = createRouter({
    history: createWebHashHistory(),
    routes: constantRoutes,
    scrollBehavior: () => ({left: 0, top: 0})
})


export default router
